package org.example.model.enums;

/**
 * @Author: Ran
 * @Date: 2021/9/22
 **/
public enum SceneEnum {
    /**
     * 0-采购
     */
    PURCHASE(0, "采购"),
    /**
     * 1-补货
     */
    REPLENISH(1, "补调"),

    ;
    public final int code;
    public final String cnName;

    SceneEnum(int code, String cnName) {
        this.code = code;
        this.cnName = cnName;
    }

    /**
     * code转换为 ReplenishSceneEnum
     *
     * @param code
     * @return
     */
    public static SceneEnum of(int code) {

        for (SceneEnum typeEnum : SceneEnum.values()) {
            if (typeEnum.code == code) {
                return typeEnum;
            }
        }
        return null;
    }

}
